package com.iweipan.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by xyb on 2016/12/6.
 */

public class TheHomeViewPager extends ViewPager {

    public TheHomeViewPager(Context context) {
        super(context);
    }


    public TheHomeViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
//        Log.e("TheHomeViewPager", "getWidth():" + width);

        float rawX = ev.getRawX();
//        float rawY = ev.getRawY();
//        Log.e("TheHomeViewPager", "rawX:" + rawX);

        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                break;
            case MotionEvent.ACTION_MOVE:
                int currentItem = this.getCurrentItem();
                int count = this.getAdapter().getCount();
                if (currentItem == count - 1 || currentItem == 0) {
                        return false;
                }
                break;
        }

        return super.onInterceptTouchEvent(ev);
    }
}
